<template>
	<div class="five">
        <x-input
        is-type="china-mobile"
        :show-clear=true
        placeholder="请输入手机号" class="phoneNum" v-model="phone"></x-input>
        <group class="weui-cells_form">
          <x-input placeholder="请填写验证码" class="weui-vcode">
            <x-button slot="right" type="primary" mini class="sendCode">发送验证码</x-button>
          </x-input>
        </group>
        <p>未注册用户将自动完成注册并登录</p>
        <x-button  @click.native="myclick" type="warn" class="loginbtn">登录</x-button>
    </div>

</template>


<script>
    import stores from './mystore.js'
    import Vue from 'vue';
 console.log(stores.aa)
//  console.debug(this.$store);
//  console.debug(this.$store.state.rests.register.url);
// console.debug(this.$store.state.register);
import { XButton, XInput, Tab, TabItem ,Group} from 'vux'
	export default {
        
     methods: {
       myclick() {
           let xixx = {
               "userInfo":{"mobile":this.phone}
           }
           this.$http.post("http://192.168.100.106:8881/top/api/users/loginOrRegister",xixx).then(function (res){
               if(res.body.returnCode == 0){
                   window.localStorage.setItem('sessionId',res.body.returnValue.sessionId)
                   var OrderSure=localStorage.getItem('OrderSure')
                   if(OrderSure == "not"){
                       this.$router.push('/OrderSure')
                   }else{
                       this.$router.push('/MyCardPack')
               }
                   }
                   
           }).then( err => { console.error(err);})
       }
    },
      components: {
            Group,
            XButton,
			XInput,
			Tab,
			TabItem
      }
}


</script>
<style type="text/css" >
.bg-leave {
	background: white;
}
.bg-enter{
	background:yellow;
}
.bg-enter-active{
	background: blue;
	transition:background-color 4s;
}
.bg-leave-active{
	background: red;
	transition:background-color 4s;
}
</style>
<style>
    .five .weui-cells:before,.five .weui-cells:after,.five .weui-btn:after{border:0;}
    body{background:#efeff8;}
    .five .vux-x-input{height:12vw; width:80.3vw; margin:0 auto; margin-top:12vw; padding:0; background:#fff; border-radius:1.4vw;font-size:4vw; padding-right:5vw;}
    .five .weui-vcode{margin:0 auto; margin-top:5.3vw;}
    .phoneNum .weui-cell__hd{width:10.7vw;}
    .five .weui-cell__hd{width:10.7vw;}
    .five .vux-no-group-title{margin:0; background:rgba(0,0,0,0)}
    .five .code{margin-top:3vh; }
    .five .weui-cell:before{border:0;}
    .five p{padding-left:9.9vw; font-size:3.5vw; line-height:13.9vw; padding-bottom:2.67vw;}
    .five .sendCode{background:none; border-radius:0; border-left:1px solid #c8c7cc; font-size:3.5vw;color:#b49436; height:6.67vw; line-height:6.67vw;}
    .five .loginbtn{height:12vw; width:80.3vw; margin:0 auto; background:#ccb884; font-size:4.5vw;} 
    ::-webkit-input-placeholder { /* WebKit browsers */ 
    color: #c8c7cc; 
    } 
    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ 
    color: #c8c7cc; 
    } 
    ::-moz-placeholder { /* Mozilla Firefox 19+ */ 
    color: #c8c7cc; 
    } 
    :-ms-input-placeholder { /* Internet Explorer 10+ */ 
    color: #c8c7cc; 
    } 
</style>
